package org.example.shop.jults;

import java.util.Scanner;

public class main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.println("=== 密码加密演示 ===");
        System.out.print("请输入要加密的密码: ");
        String password = scanner.nextLine();

        // 加密密码
        String hashedPassword = PasswordUtils.hashPassword(password);
        System.out.println("加密后的密码: " + hashedPassword);

        System.out.print("\n请再次输入密码进行验证: ");
        String verifyPassword = scanner.nextLine();

        // 验证密码
        boolean isMatch = PasswordUtils.checkPassword(verifyPassword, hashedPassword);
        if (isMatch) {
            System.out.println("密码匹配成功!");
        } else {
            System.out.println("密码不匹配!");
        }

        scanner.close();
    }
}